<?php


class Module_model extends CI_Model {
	public $modules_cache;
	private $CI;
	
	function __construct() {
		parent::__construct();
		
		$this->CI =& get_instance();
	}
	
	function get_module ($name) {
		if (!isset($this->modules_cache[$name])) {
			return FALSE;
		}
		
		return $this->modules_cache[$name];
	}
	

	function get_modules () {
		return $this->modules_cache;
	}
	

	function get_module_folders () {
		$directory = APPPATH . 'modules/'; 
		$this->CI->load->helper('directory');
		
		$modules = directory_map($directory, 1);
		
		return $modules;
	}
}